package com.cqhilink.api.common.utils.security.sha1;


import com.cqhilink.api.common.utils.security.base64.Base64Encod;

import java.security.MessageDigest;

/**
 * 单向加密不可逆
 * Created by wangzhen on 2016/7/13.
 */
public class SHA1 {
    public static String encryptSHA1(String content) throws Exception {
        MessageDigest messageDigest = MessageDigest.getInstance("SHA-1");
        byte[] bytes = messageDigest.digest(content.getBytes("UTF-8"));
        // 对摘要字符串进行base64编码
        String encryptContent = Base64Encod.byte2base64(bytes);
        return encryptContent;
    }
}
